package com.template.app.util;

import java.io.PrintWriter;
import java.io.StringWriter;

public class LogUtils {

	public static final String INFO_LOGGER = "infoAppender";
	public static final String ERROR_LOGGER = "errorAppender";
    
    public static String getExceptionMessage(Throwable e) {
        String exception = e.getClass().getName() + ": ";
        
        if (e.getMessage() != null) {
            exception += e.getMessage();
        }
        
        if (e.getCause() != null) {
            exception += " - cause: " + e.getCause().getMessage();
        }

        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        exception += " \r\n\tStack Trace: " + sw.toString();

        return exception;
    }
}
